<template>
	<div v-show="active"><slot></slot></div>
</template>
<script>
	export default {
		props:{
			label:String,
			name:String,
			activeValue:String
		},
		data(){
			return {
				loaded:false
			}
		},
		computed: {
			active() {
				return this.name==this.$parent.value;
			}
		},
		
		watch:{
			active(value){
				if (value && !this.loaded) {//第一次加载
					this.$emit('load');
					this.$emit('change');
					this.loaded=true;
				}else if(value){
					this.$emit('change');
				}
			}
		},
		mounted() {
			this.$parent.addPanes(this);
			console.log(this.activeValue);
			if (this.name==this.$parent.value && !this.loaded) { //第一次加载
				this.$emit('load');
				this.$emit('change');
				this.loaded=true;
			}
		}
	}
</script>
